from entity.UserModel import User
from utils import dbUtil

currentUser: User = None


def login(user: User):
    con = None
    try:
        con = dbUtil.getCon()
        cursor = con.cursor()
        cursor.execute(f"SELECT * FROM t_user_back WHERE username='{user.userName}' and password='{user.password}'")
        return cursor.fetchone()
    except:
        con.rollback()
        return None
